/*
 * GLColor.hpp
 *
 *  Created on: 01-12-2010
 *      Author: Przemek
 */

#pragma once

#include "RangedValue.hpp"

/*
 * OpenGL color adapter. Can set valid openGL color state.
 */
class GLColor
{
	public:
		static const GLColor WHITE;
		static const GLColor BLACK;
		static const GLColor RED;
		static const GLColor GREEN;
		static const GLColor BLUE;

	private:
		static const Range<float> ZERO_ONE_RANGE;
		RangedValue<float> r;
		RangedValue<float> g;
		RangedValue<float> b;

	public:
		explicit GLColor(float r = 1.0f, float g = 1.0f, float b = 1.0f);
		GLColor(const GLColor& other);
		GLColor& operator=(const GLColor& other);

		void set(int r, int g, int b);
		// alpha value is 1.0f - fully opaque
		void setGLState() const;
		void setGLState(float alpha) const;
		GLColor lighten(float amount) const;
		GLColor darken(float amount) const;
};
